package com.session02.homework;

public class Test1 {
    public static void main(String[] args) {
        //查找"bbcafdfcccaffaaafereafafefaiaf"中有多少个af？
        // 请使用String当中提供的方法完成
        String str = "bbcafdfcccaffaaafereafafefaiaf";
        int count = 0;
        for (int i = 0; i <= str.length() - 2; i++) {
            String s = str.substring(i, i + 2);
            if (s.equals("af")) {
                count++;
            }
        }
        System.out.println("af的个数是：" + count);
    }
}
